import request from '@/utils/request'

/**
 *  分页查询
 * @param pageNum
 * @param pageSize
 * @param searchName
 * @returns {AxiosPromise}
 */
export const findPage = (pageNum, pageSize, searchName) => {
  return request({
    url: `/admin/product/productSpec/findPage/${pageNum}/${pageSize}`,
    method: 'get',
    params: {
      searchName: searchName,
    },
  })
}

/**
 *  添加规格
 * @param productSpec
 * @returns {AxiosPromise}
 */
export const doAdd = productSpec => {
  return request({
    url: `/admin/product/productSpec/addProductSpec`,
    method: 'post',
    data: productSpec,
  })
}

/**
 *  修改商品规格信息
 * @param productSpec
 * @returns {AxiosPromise}
 */
export const updateProductSpec = productSpec => {
  return request({
    url: `/admin/product/productSpec/updateProductSpec`,
    method: 'put',
    data: productSpec,
  })
}

/**
 *  删除商品规格信息
 * @param productSpec
 * @returns {AxiosPromise}
 */
export const deleteProductSpec = id => {
  return request({
    url: `/admin/product/productSpec/deleteProductSpec/${id}`,
    method: 'delete',
  })
}
